﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using WOIM_NET.Music;

namespace WOIM_NET
{
    public partial class AlbumsPage : PhoneApplicationPage
    {
        public AlbumsViewModel NewAlbums;
        
        public AlbumsPage()
        {
            InitializeComponent();
            NewAlbums = new AlbumsViewModel();
            NewAlbumsList.DataContext = NewAlbums;
        }

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (!NewAlbums.IsDataLoaded)
            {
                NewAlbums.LoadData("http://www.nhaccuatui.com/playlist/khong-loi-moi.html");
            }
        }

        private void NewAlbumsList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            
        }

        private void NewAlbumsList_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            AlbumModel current = (AlbumModel)NewAlbumsList.SelectedItem;
            NavigationService.Navigate(new Uri("/PlayPage.xaml?model=AlbumPlay&url=" + current.Url + "&avatar=" + current.Avatar + "&name=" + current.Name, UriKind.Relative));
        }
    }
}